home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Cream of the Crop 22
/
Cream of the Crop 22.iso
/
program
/
asm32.zip
/
E32.ZIP
/
SHOWFKEY.ASM
< prev
next >
Wrap
Assembly Source File
|
1996-08-26
|
3KB
|
165 lines
; SHOWFKEY.ASM for E32 - Copyright (C) 1994 - 1996 Douglas Herr
; all rights reserved
; 01/07/1996 DH: added flashing MARK if mark mode ON
; 03/22/1996 DH: changed F8 from DEL_EOL to LINE menu
include model.inc
public showfkey
extrn tputchr:near
extrn strnlwr:near
extrn strnupr:near
extrn i4tostr:near
include dataseg.inc
extrn normal:byte, inverse:byte
extrn rows:byte, columns:byte
extrn cur_posn:word, left_margin:word
extrn key_status:byte, file_row:dword, dirty_bits:byte
extrn mark_mode:byte
public swapmode_prompt
shiftkey equ 3
ctrl equ 4
altb equ 8
nbuff db 12 dup(0)
fkey db ' F'
keynum db '1',0,0
altfkeys db ' NEW ',0,'ROWS',0,'FFEED',0,'COPY',0,' DOS ',0
db 'UCASE',0,'LOAD',0,'COLUMNS',0,'LCASE',0,' FIND',0
altfkey_len equ $-altfkeys
; ctrl+Fkey prompts
ctrlfkeys db ' ',0,' ',0,' ',0,'PUSH',0,'POP ',0
db 'WINDOW',0,'SWAP',0
swapmode_prompt db '2 files',0,'GO TO',0,' NEXT',0,0
ctrlfkey_len equ $-ctrlfkeys
; shift+Fkey prompts
shiftfkeys db "SETUP",0," ",0," PRN",0
mark_msg db "MARK",0,"CUT",0,"PASTE",0," ",0
db "DEL EOL",0,"DEL L",0,"REPLACE",0,0
shiftfkey_len equ $-shiftfkeys
fkeys db 'UNDO',0,'FIND',0,'PRINT',0
block_msg db 'BLOCK',0,'GOTO',0,'SCREEN',0,'FILE',0
db 'LINE',0,'DEL L',0,'UDEL L',0
fkey_len equ $-fkeys
case dd offset CGROUP:strnlwr
dd offset CGROUP:strnupr
@curseg ends
include codeseg.inc
;
; this displays the function key prompt and capslock state
;
showfkey proc near
push ebp
and dirty_bits,11101111b
mov word ptr keynum,'1'
; select fkey display
movzx eax,key_status ; gonna use key_status some
; so put it in AL for speed
; start with ALT test
lea ebx,altfkeys
mov ecx,altfkey_len
test al,altb
jnz short c
; test for CTRL key press
add ebx,ecx ; point to Ctrl+FKey prompts
mov cx,ctrlfkey_len
test al,ctrl
jnz short c
; test for Shift key press
add ebx,ecx ; point to shift+FKey prompts
mov cx,shiftfkey_len
test al,shiftkey
jnz short c
; no Alt, Ctrl or Shift
add ebx,ecx ; point to ordinary FKey prompts
mov cx,fkey_len
; make the function keys upper case or lower case, depending on
; CAPSLOCK status
c:
and al,64
rol al,4 ; EAX either 0 or 4
call case[eax] ; EBX points to prompts, ECX = prompt length
movzx ebp,columns ; save number of columns
mov dh,rows ; put prompt at last row
inc dh
xor dl,dl ; column zero
cmp bp,40
ja short c3
shl ebp,1
c3:
mov ecx,10
lea esi,fkey+1 ; start with the numeral
f01: mov ah,normal
cmp keynum,':'
jne short f02
mov word ptr keynum,'01'
f02: call print
mov ebx,esi ; save pointer to prompts
lea esi,fkey
inc keynum
loop f01
; clear the remainder of the row
mov al,' ' ; space character
mov ah,normal
mov ecx,ebp
sub cl,dl
jz short f03
f02d: call tputchr
inc dl
loop f02d
f03: pop ebp
ret
showfkey endp
print:
call p8
mov esi,ebx ; point to prompts
mov ah,inverse
; make MARK blink if mark_mode is ON
lea ebx,mark_msg
sub ebx,esi
jnz short p0
cmp mark_mode,bl
je short p0
xor ah,80h
p0:
lea ebx,block_msg
sub ebx,esi
jnz short p8
cmp mark_mode,bl
je short p8
xor ah,80h
p8:
lodsb
test al,al
jz short p9
call tputchr
inc dl ; next column
jmp p8
p9: ret
@curseg ends
end